<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;

class UserController extends Controller
{
    //
    public function create(){

        return view('users.create');
    }

    public function show(User $user){
        $gravatar = $this -> gravatar();
        return view('users.show',compact('user','gravatar'));
    }

    public function gravatar($size = '100'){
        $hash = md5(strtolower(trim($this->attributes('email'))));
        return "http://www.gravatar.com/avatar/$hash?s=$size";
    }
}
